<template>
  <div id="app">
    <!-- 顶部区域 -->
    <mt-header fixed title="固定在顶部">
      <span @click="goback" slot="left" v-show="falg">
        <mt-button icon="back">返回</mt-button>
      </span>
    </mt-header>
    <!-- 内容 router-view区域 -->
    
    <transition >
      <router-view></router-view>
    </transition>

    <!-- 底部区域 -->
    <nav class="mui-bar mui-bar-tab">
      <router-link to="/home" class="mui-tab-item-llb">
        <span class="mui-icon mui-icon-home"></span>
        <span class="mui-tab-label">首页</span>
      </router-link>
      <router-link to="/member" class="mui-tab-item-llb ">
        <span class="mui-icon mui-icon-email"></span>
        <span class="mui-tab-label">消息</span>
      </router-link>
      <router-link to="/shopcar" class="mui-tab-item-llb ">
        <span class="mui-icon mui-icon-contact"><span class="mui-badge" id="badge">{{$store.getters.getAllCount}}</span></span>
        <span class="mui-tab-label">通讯录</span>
      </router-link>
      <router-link to="/search" class="mui-tab-item-llb ">
        <span class="mui-icon mui-icon-search"></span>
        <span class="mui-tab-label">搜索</span>
      </router-link>
    </nav>


    <!-- <mt-tabbar v-model="selected">
      <mt-tab-item id="外卖">
        <img slot="icon" src="../src/assets/logo1.png">
        外卖
      </mt-tab-item>
      <mt-tab-item id="订单">
        <img slot="icon" src="../src/assets/logo1.png">
        订单
      </mt-tab-item>
      <mt-tab-item id="发现">
        <img slot="icon" src="../src/assets/logo1.png">
        发现
      </mt-tab-item>
      <mt-tab-item id="我的">
        <img slot="icon" src="../src/assets/logo1.png">
        我的
      </mt-tab-item>
    </mt-tabbar> -->

    
  </div>
</template>

<script>
export default ({
  data(){
    return{
      name: '#App',
      falg:false
    }
  },
  created(){
    this.falg=this.$route.path==='/Home'?false:true
  },
  methods:{
    goback(){
      this.$router.go(-1)
    }
  },
  watch:{
    "$route.path":function(newVal){
      if(newVal === "/Home"){
        this.falg = false
      }else{
        this.falg = true
      }
    }
  }
})
</script>

<style lang="scss" scoped>
.mint-header{
  z-index: 999;
}

#app {
  padding-top: 40px;
  padding-bottom:50px;
  overflow-x: hidden;
}
.v-enter{
  opacity: 0;
  transform: translateX(100%);
}
.v-leave-to{
  opacity: 0;
  transform: translateX(-100%);
  position:absolute;
}
.v-enter-active,
.v-leave-active{
  transition: all 0.5s ease;
}
//改变样式
.mui-bar-tab .mui-tab-item-llb.mui-active {
    color: #007aff;
}
.mui-bar-tab .mui-tab-item-llb {
    display: table-cell;
    overflow: hidden;
    width: 1%;
    height: 50px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;
    color: #929292;
}
.mui-bar-tab .mui-tab-item-llb .mui-icon {
    top: 3px;
    width: 24px;
    height: 24px;
    padding-top: 0;
    padding-bottom: 0;
}
.mui-bar-tab .mui-tab-item-llb .mui-icon ~ .mui-tab-label {
    font-size: 11px;
    display: block;
    overflow: hidden;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;
}
</style>
